<!-- 1903010328 查询通行证 -->
<?php
include "../inc/log/adsession.php";
?>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>后台首页</title>
	<link rel="stylesheet" type="text/css" href="/28/inc/CSS/admin">
	<link rel="stylesheet" type="text/css" href="/28/inc/CSS/reset.css">
<?php
	include "../inc/data/connAdmin.php";

// 预处理sql语句，得到mysqli_stmt对象，绑定参数
$sql = "select stuid,stuname,classname from mamx_stu ";
if (!($stmt = $conn->prepare($sql))){
	#预处理失败
	die("预处理失败！");
};
// 绑定结果 执行查询
$stmt->execute();
$stmt->bind_result($stuid,$stuname,$classname);

// 保存结果记录 读取结果数量 获取记录
$stmt->store_result();
echo $stmt->num_rows;
?>
<!--1903010328 统计信息 -->
<?php
		//  统计专业
		$sql="select depname ,count(depname) from mamx_major
			 group by depname";
		$re=$conn->query($sql);
		// 遍历
		while ($row=$re->fetch_assoc()){
			$mSum[$row["depname"]]=$row["count(depname)"];
		}
		//  统计班级
		$sql = "select depname,count(depname)
				from mamx_class,mamx_major
				where mamx_class.majorname = mamx_major.majorname
				group by depname";
		$re2 = $conn->query($sql);
		while ($row=$re2->fetch_assoc()) {
			$cSum[$row["depname"]]=$row["count(depname)"];
		}

		//   统计学生
		$sql = "select depname,count(depname)
				from mamx_stu,mamx_class,mamx_major
				where mamx_stu.classname=mamx_class.classname
				and mamx_class.majorname=mamx_major.majorname
				group by depname";
		$re3 = $conn->query($sql);
		while ($row=$re3->fetch_assoc()) {
			$sSum[$row["depname"]]=$row["count(depname)"];
		}
		//  统计老师
		$sql = "select depname,count(depname)
				from mamx_teacher
				group by depname";
		$re4 = $conn->query($sql);
		while ($row=$re4->fetch_assoc()) {
			$tSum[$row["depname"]]=$row["count(depname)"];
		}

		//  统计课程
		$sql = "select depname,count(depname)
				from mamx_course,mamx_major
				where mamx_course.majorname = mamx_major.majorname
				group by depname";
		$re5 = $conn->query($sql);
		while ($row=$re5->fetch_assoc()) {
			$couSum[$row["depname"]]=$row["count(depname)"];
		}

		//  统计教学任务数
		$sql = "select depname,count(depname)
				from mamx_teacher,mamx_task
				where mamx_teacher.teid=mamx_task.teid
				group by depname";
		$re6 = $conn->query($sql);
		while ($row=$re6->fetch_assoc()) {
			$TaSum[$row["depname"]]=$row["count(depname)"];
		}
	?>

</head>
<body>
	<div id="tScoreln">
		<!--顶部-->
			<div id="top">
			<img src="/28/inc/pic/00.png">
			<!--导航栏区域和下拉列表-->
			<div id="top-rig">
			<ul>
			    <li><a href="">首页</a></li>
			    <li id="ddown"><a href="" id="dropbtn">学校概况</a>
				    <div id="ddown-content">
				    <a href="">学校简介</a>
				    <a href="">历任教师</a>
				    </div>
				</li>
				<li id="ddown"><a href="" id="dropbtn">国际合作</a>
				    <div id="ddown-content">
				    <a href="">交流概况</a>
				    <a href="">国际学生</a>
				    </div>
				</li>
				<li id="ddown"><a href="" id="dropbtn">院系部门</a>
				    <div id="ddown-content">
				    <a href="">党群机构</a>
				    <a href="">管理与服务机构</a>
				    </div>
				</li>
				<li id="ddown"><a href="" id="dropbtn">科学研究</a>
				    <div id="ddown-content">
				    <a href="">科研概况</a>
				    <a href="">重点学科</a>
				    </div>
				</li>
				<li id="ddown"><a href="" id="dropbtn">教师队伍</a>
				    <div id="ddown-content">
				    <a href="">总体介绍</a>
				    <a href="">杰出人才</a>
				    </div>
				</li>
				<li id="ddown"><a href="" id="dropbtn">人才培养</a>
				    <div id="ddown-content">
				    <a href="">继续教育</a>
				    <a href="">奖贷学金</a>
				    </div>
				</li>
				<li id="ddown"><a href="" id="dropbtn">人才招聘</a>
				    <div id="ddown-content">
				    <a href="">优秀博士后</a>
				    <a href="">应聘方式</a>
				    </div>
				</li>
                <li id="ddown"><a href="" id="dropbtn">招生就业</a>
				    <div id="ddown-content">
				    <a href="">本科生招生</a>
				    <a href="">就业服务</a>
				    </div>
				</li>
				<img src="/28/inc/pic/find1.png">
		    </ul>
			</div>
			</div>
	    <!--顶部结束-->
	    <!---->
	    	<div id="main">
	        	<img src="/28/inc/pic/position.png">
	    		当前位置: 后台首页
	    <!--结束-->
	    <div id="yh">
	    <img src="/28/inc/pic/user.png" style="width:25px;height:25px;margin:3px 10px;">
		<!-- 1903010328 动态信息 -->
		<h4 style="margin:8px 10px;font-size:20px;color:#1D50A2">您好！
		<?=$_SESSION["uName"]?>
		</h4>
	    </div>
	    <div id="SZ" style="">
	    	<ul style="font-size:20px;">
				<li id="" style="">
				<a href="/28/admin/menu/menuAdmin.php">菜单管理</a></li>
				<li id="" style="">
				<a href="/28/admin/dep/depAdmin.php">二级学院管理</a></li>
				<li id="" style="">
				<a href="">教师管理</a></li>
				<li id="" style="">
				<a href="/28/admin/stu/stuAdmin.php">学生管理</a></li>
				<li id="" style="">
				<a href="/28/admin/cou/courseAdmin.php">课程管理</a></li>
				<li id="" style="">
				<a href="28/admin/course/taskAdmin.php">教学任务管理</a></li>
				<li id="" style="">
				<a href="/28/admin/adminQuit.php">注销</a></li>
			</ul>
	    </div>
		<!--结束-->
		<!-- 查询班级和教学id号 -->
	    <!--表格区域-->
	<div class="table-index">
		<!-- 统计表 -->
			<table style="width:90%;height:100px;margin:100px 80px;text-align:center;font-weight:bold;border:4px solid #1D50A2">
				<tr style="font-size:30px;color:#43a85e">
					<td>序号</td>
					<td>二级学院</td>
					<td>专业数量</td>
					<td>班级数量</td>
					<td>老师数量</td>
					<td>课程数量</td>
					<td>教学任务数量</td>
				</tr>
				<?php
					$sql02="select depname from mamx_dep";
					$re = $conn->query($sql02);
					$i=1;
					while ($row=$re->fetch_assoc()){
				?>
				<tr style="font-size:25px;">
					<td><?=$i?></td>
					<td><?=$row["depname"]?></td>
					<td><?=$mSum[$row["depname"]]?></td>
					<td><?=$cSum[$row["depname"]]?></td>
					<td><?=$tSum[$row["depname"]]?></td>
					<td><?=$couSum[$row["depname"]]?></td>
					<td><?=$TaSum[$row["depname"]]?></td>
				</tr>
				<?php
					$i++;
					}
				?>
			</table>
		</div>
	</div>
</body>
</html>